package com.glorysoft.lipuxinpda.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RadioButton;
import android.widget.TextView;

import com.glorysoft.lipuxinpda.R;
import com.glorysoft.lipuxinpda.entity.MaterialInfoEntity;

import java.util.List;

public class DieListAdapter extends BaseAdapter {
    private Context mContext;
    private String[] splite;
    private ViewHolder viewHolder;

    public DieListAdapter(Context mContext, String[] splite) {
        this.mContext = mContext;
        this.splite = splite;
    }

    @Override
    public int getCount() {
        return splite.length;
    }

    @Override
    public Object getItem(int position) {
        return splite[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null){
            viewHolder = new ViewHolder();
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_die_type_list, null);
            viewHolder.tv_die_type = convertView.findViewById(R.id.tv_die_type);

            convertView.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        viewHolder.tv_die_type.setText(splite[position]);

        return convertView;
    }

    class ViewHolder{
        private TextView tv_die_type;//芯片类型
    }
}
